package org.groupg.filetodb.model.database;




import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

import java.io.Serializable;

/**
 * 表示函数参数/返回列元数据
 */
public class FunctionColumn implements Serializable {
    /** 函数目录 */
    private String functionCat;
    /** 函数模式 */
    private String functionSchem;
    /** 函数名 */
    private String functionName;
    /** 列/参数名 */
    private String columnName;
    /** 列类型 (DatabaseMetaData.functionColumnXXX) */
    private short columnType;
    /** SQL类型 (java.sql.Types) */
    private int dataType;
    /** 数据库类型名 */
    private String typeName;
    /** 精度 */
    private int precision;
    /** 数据长度（字节） */
    private int length;
    /** 小数位数 */
    private short scale;
    /** 基数 */
    private short radix;
    /** 是否允许NULL */
    private short nullable;
    /** 备注 */
    private String remarks;
    /** 字符列的最大字节长度 */
    private int charOctetLength;
    /** 参数位置（从1开始） */
    private int ordinalPosition;
    /** "YES"/"NO"/"" 表示是否可空 */
    private String isNullable;
    /** 特定名称（唯一标识） */
    private String specificName;

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("functionCat", functionCat)
                .add("functionSchem", functionSchem)
                .add("functionName", functionName)
                .add("columnName", columnName)
                .add("columnType", columnType)
                .add("dataType", dataType)
                .add("typeName", typeName)
                .add("precision", precision)
                .add("length", length)
                .add("scale", scale)
                .add("radix", radix)
                .add("nullable", nullable)
                .add("remarks", remarks)
                .add("charOctetLength", charOctetLength)
                .add("ordinalPosition", ordinalPosition)
                .add("isNullable", isNullable)
                .add("specificName", specificName)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        FunctionColumn that = (FunctionColumn) o;
        return getColumnType() == that.getColumnType() && getDataType() == that.getDataType() && getPrecision() == that.getPrecision() && getLength() == that.getLength() && getScale() == that.getScale() && getRadix() == that.getRadix() && getNullable() == that.getNullable() && getCharOctetLength() == that.getCharOctetLength() && getOrdinalPosition() == that.getOrdinalPosition() && Objects.equal(getFunctionCat(), that.getFunctionCat()) && Objects.equal(getFunctionSchem(), that.getFunctionSchem()) && Objects.equal(getFunctionName(), that.getFunctionName()) && Objects.equal(getColumnName(), that.getColumnName()) && Objects.equal(getTypeName(), that.getTypeName()) && Objects.equal(getRemarks(), that.getRemarks()) && Objects.equal(getIsNullable(), that.getIsNullable()) && Objects.equal(getSpecificName(), that.getSpecificName());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getFunctionCat(), getFunctionSchem(), getFunctionName(), getColumnName(), getColumnType(), getDataType(), getTypeName(), getPrecision(), getLength(), getScale(), getRadix(), getNullable(), getRemarks(), getCharOctetLength(), getOrdinalPosition(), getIsNullable(), getSpecificName());
    }

    public String getFunctionCat() {
        return functionCat;
    }

    public void setFunctionCat(String functionCat) {
        this.functionCat = functionCat;
    }

    public String getFunctionSchem() {
        return functionSchem;
    }

    public void setFunctionSchem(String functionSchem) {
        this.functionSchem = functionSchem;
    }

    public String getFunctionName() {
        return functionName;
    }

    public void setFunctionName(String functionName) {
        this.functionName = functionName;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public short getColumnType() {
        return columnType;
    }

    public void setColumnType(short columnType) {
        this.columnType = columnType;
    }

    public int getDataType() {
        return dataType;
    }

    public void setDataType(int dataType) {
        this.dataType = dataType;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public int getPrecision() {
        return precision;
    }

    public void setPrecision(int precision) {
        this.precision = precision;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public short getScale() {
        return scale;
    }

    public void setScale(short scale) {
        this.scale = scale;
    }

    public short getRadix() {
        return radix;
    }

    public void setRadix(short radix) {
        this.radix = radix;
    }

    public short getNullable() {
        return nullable;
    }

    public void setNullable(short nullable) {
        this.nullable = nullable;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public int getCharOctetLength() {
        return charOctetLength;
    }

    public void setCharOctetLength(int charOctetLength) {
        this.charOctetLength = charOctetLength;
    }

    public int getOrdinalPosition() {
        return ordinalPosition;
    }

    public void setOrdinalPosition(int ordinalPosition) {
        this.ordinalPosition = ordinalPosition;
    }

    public String getIsNullable() {
        return isNullable;
    }

    public void setIsNullable(String isNullable) {
        this.isNullable = isNullable;
    }

    public String getSpecificName() {
        return specificName;
    }

    public void setSpecificName(String specificName) {
        this.specificName = specificName;
    }
}
